package com.itheima.dao;
/*
* 最大值和最小值
* */
public class Method11 {
    public static void main(String[] args) {
        int []arr={11,55,33,22,44};
        int[] ints = maxAndMin(arr);
        System.out.println(ints[0]);
        System.out.println(ints[1]);

    }
    public static int[] maxAndMin(int[]arr){
        int max=arr[0];
        int min=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max<arr[i]){
                max=arr[i];
            }
            if (min>arr[i]){
                min=arr[i];
            }
        }
        int []and={max,min};
        return and;
    }
}
